#include <iostream>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int main(){
    char c;
    c=getchar();
    string str="";
    vector<string> vec;
    while (1){
        c=getchar();
        if (c!=','&&c!=']'){
            str+=c;
        }
        else{
            if (str!="")vec.push_back(str);
            //cout<<str;
            str.clear();
            
        }
        if (c==']'){
            break;
        }
    }
    int n=vec.size();//层数为log2(n+1)
    //for (int i=0;i<n;i++){cout<<vec[i]<<endl;}
    //cout<<n<<endl;
    double i=log(n+1)/log(2);
    int cengshu=(int)ceil(i);
    /*int cengshu;
    if ((i-(int)i)<(1e-6)){
        cengshu=(int)i;
    }else{
        cengshu=cengshu2;
    }*/
    //cout<<cengshu<<endl;
    cout<<'[';
    int count=1;
    for (int i=1;i<=cengshu;i++){
        
        int number=pow(2,i)-2;
        if (number>=n-1)number=n-1;
        
        while (vec[number]=="null"){number--;}
        //cout<<number<<endl;
        if(number<0||number<=pow(2,i-1)-2){break;}
        if (count==0)cout<<',';
        cout<<vec[number];
        
        count=0;
    }
    cout<<']'<<endl;
    return 0;
}





